<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserRecordTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_record', function (Blueprint $table) {
            $table->increments('id');
            $table->string('openid',90)->unique();
            $table->string('nickname',90);
            $table->integer('sex'); // 1:male  2:female 3:unknow
            $table->string('city',30);
            $table->string('country',30);
            $table->string('province',30);
            $table->string('language',30); //用户的语言，简体中文为zh_CN
            $table->string('headimgurl',200); //用户头像，最后一个数值代表正方形头像大小（有0、46、64、96、132数值可选，0代表640*640正方形头像），用户没有头像时该项为空。若用户更换头像，原有头像URL将失效。
            $table->integer('subscribe_time'); // 关注时间戳
            $table->string('unionid')->nullable();

            $table->tinyInteger('isband');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('user_record');
    }
}
